

import type { Istoreproduct } from './entity';
import type { IPageParams } from '@/types/table'
import request from '@/api/request'

export function getPageList(params: IPageParams) {
  return request({
    url: `admin/store/product/list`,
    method: 'get',
    params,
    loading: true
  })
}
/**
 * 商品列表 表头数量
 */
export function productHeadersApi() {
  return request({
    url: '/admin/store/product/tabs/headers',
    method: 'GET'
  })
}
/**
 * 商品分类
 * @param pram
 */
export function categoryApi(params) {
  return request({
    url: '/admin/category/list/tree',
    method: 'GET',
    params
  })
}
export function storeproductDel(id: number, type: string) {
  return request({
    url: `/admin/store/product/delete/${id}`,
    method: 'get',
    params: { type: type }
  })
}
export function storeproductinfo(id) {
  return request({
    url: `admin/store/product/info/${id}`,
    method: 'get'
  })
}
export function storeproductSelect(id) {
  return request({
    url: `admin/store/product/select`,
    method: 'get'
  })
}

export function storeproductAddup(data) {
  return request({
    url: `admin/store/product/${!data.id ? 'save' : 'update'}`,
    method: 'post',
    data
  })
}
/**
 * 商品上架
 * @param pram
 */
export function putOnShellApi(id) {
  return request({
    url: `/admin/store/product/putOnShell/${id}`,
    method: 'GET'
  })
}
/**
 * 商品下架
 * @param pram
 */
export function offShellApi(id) {
  return request({
    url: `/admin/store/product/offShell/${id}`,
    method: 'GET'
  })
}
/**
 * 商品列表 导出
 * @param pram
 */
export function productExcelApi(params) {
  return request({
    url: `/admin/export/excel/product`,
    method: 'get',
    params
  })
}

/**
 * 恢复
 * @param pram
 */
export function restoreApi(id) {
  return request({
    url: `/admin/store/product/restore/${id}`,
    method: 'get'
  })
}

/**
 * 商品规格 列表
 * @param pram
 */
export function templateListApi(params) {
  return request({
    url: '/admin/store/product/rule/list',
    method: 'GET',
    params
  })
}

// 物流运费模板列表
export function shippingTemplatesList(data) {
  return request({
    url: '/admin/express/shipping/templates/list',
    method: 'get',
    params: { ...data }
  })
}
/**
 * @description 页面设计商品Tab 获取数据
 */
export function goodDesignList(params) {

  return request({
    url: '/admin/system/group/data/list',
    method: 'GET',
    params
  })
}
/**
 * 用户管理 优惠券列表
 * @param pram
 */
export function marketingSendApi(params) {
  return request({
    url: '/admin/marketing/coupon/send/list',
    method: 'get',
    params
  })
}
